From 65f0755dd8a2a5bb560c86b09d1c45b3006b2fdc Mon Sep 17 00:00:00 2001 From: justbur Date: Fri, 13 Nov 2015 12:03:26 -0500 Subject: [PATCH] Fix sort order of function keys --- which-key.el | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/which-key.el b/which-key.el index 7025fc5dc46..caf1744c8b9 100644 --- a/which-key.el +++ b/which-key.el @@ -972,18 +972,23 @@ width) in lines and characters respectively." (bsp? (string-match-p srgxp b)) (prrgxp "^\\(M\\|C\\|S\\|A\\|H\\|s\\)-") (apr? (string-match-p prrgxp a)) - (bpr? (string-match-p prrgxp b))) + (bpr? (string-match-p prrgxp b)) + (afn? (string-match-p "" a)) + (bfn? (string-match-p "" b))) (cond ((or aem? bem?) (and aem? (not bem?))) ((and asp? bsp?) (if (string-equal (substring a 0 3) (substring b 0 3)) - (which-key--key-description< (substring a 3) (substring b 3)) + (which-key--key-description-alpha< (substring a 3) (substring b 3)) (string-lessp a b))) ((or asp? bsp?) asp?) ((and a1? b1?) (which-key--alpha< a b)) ((or a1? b1?) a1?) + ((and afn? bfn?) + (< (string-to-number (replace-regexp-in-string "" "\\1" a)) + (string-to-number (replace-regexp-in-string "" "\\1" b)))) ((and apr? bpr?) (if (string-equal (substring a 0 2) (substring b 0 2)) - (which-key--key-description< (substring a 2) (substring b 2)) + (which-key--key-description-alpha< (substring a 2) (substring b 2)) (string-lessp a b))) ((or apr? bpr?) apr?) (t (string-lessp a b))))) @@ -1009,7 +1014,9 @@ before upper." (bsp? (string-match-p srgxp b)) (prrgxp "^\\(M\\|C\\|S\\|A\\|H\\|s\\)-") (apr? (string-match-p prrgxp a)) - (bpr? (string-match-p prrgxp b))) + (bpr? (string-match-p prrgxp b)) + (afn? (string-match-p "" a)) + (bfn? (string-match-p "" b))) (cond ((or aem? bem?) (and aem? (not bem?))) ((and asp? bsp?) (if (string-equal (substring a 0 3) (substring b 0 3)) @@ -1018,6 +1025,9 @@ before upper." ((or asp? bsp?) asp?) ((and a1? b1?) (string-lessp a b)) ((or a1? b1?) a1?) + ((and afn? bfn?) + (< (string-to-number (replace-regexp-in-string "" "\\1" a)) + (string-to-number (replace-regexp-in-string "" "\\1" b)))) ((and apr? bpr?) (if (string-equal (substring a 0 2) (substring b 0 2)) (which-key--key-description< (substring a 2) (substring b 2)) -- 2.30.2